//
//  DDScriptMessageHandler.m
//  GSDache
//
//  Created by guoshikeji_a on 2017/2/20.
//  Copyright © 2017年 tanyin. All rights reserved.
//

#import "BCScriptMessageHandler.h"

@implementation BCScriptMessageHandler

- (instancetype)initWithDelegate:(id<WKScriptMessageHandler>)delegate {
    self = [super init];
    if (self) {
        self.delegate = delegate;
    }
    return self;
}

+ (instancetype)scriptMessageHandlerDelegate:(id<WKScriptMessageHandler>)delegate {
    return [[self alloc] initWithDelegate:delegate];
}


- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
    if (self.delegate && [self.delegate respondsToSelector:@selector(userContentController:didReceiveScriptMessage:)]) {
        [self.delegate userContentController:userContentController didReceiveScriptMessage:message];
    }
}






#pragma mark - dealloc
- (void)dealloc {
    NSLog(@"DDScriptMessageHandler 释放了");
}

@end
